package com.shop.util;

import com.shop.comment.Constants;

import java.util.List;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/3/11 14:58
 **/
public class PageUtil<T> {
	//集合
	private List<T> list;
	//每页显示的数量
	private int showNum = Constants.SHOW_SIZE;
	//mysql 做分页==》limit 偏移量,显示的数量
	private int beginIndex = 0;
	//当前页
	private int currentPage = 1; //默认第一页


	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public int getShowNum() {
		return showNum;
	}

	public void setShowNum(int showNum) {
		this.showNum = showNum;
	}

	public int getBeginIndex() {
		beginIndex = (currentPage-1)*showNum;
		return beginIndex;
	}


	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
}
